package com.fosu.Utils;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;

/**
 * @author zqa
 * @version 1.0
 * @date 2020/11/14 0:03
 */

public class ThreadLocal2JsonObjectUtil {

    // 定义一个线程域，存放JSONObject
    public static ThreadLocal<JSONObject> tl = new ThreadLocal<>();

    public static JSONObject getJSONObject() {
        return tl.get();
    }

    public static void setJSONObject(JSONObject jsonObject) {
        tl.set(jsonObject);
    }

    public static void removeThreadLocal() {
        tl.remove();
    }

}
